using SCADAEditor.Component;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace SCADAEditor
{
    public class RuntimeWindow : Form
    {
        private List<ComponentBase> _components = new List<ComponentBase>();

        public RuntimeWindow(List<ComponentBase> components)
        {
            _components = components;
            this.DoubleBuffered = true;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.StartPosition = FormStartPosition.CenterScreen;
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            
            // 绘制所有组件
            foreach (var component in _components)
            {
                component.Draw(e.Graphics);
            }
        }
    }
}